<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        //$this->_helper->layout()->disableLayout();
    }

    public function loginAction()
    {
        $this->_helper->viewRenderer->setNoRender();
        
        $user = $this->getRequest()->getParam('user');
        $pass = $this->getRequest()->getParam('pass');
        
        $users = new Model_Users();                
        
        $login = $users->fetchRow("username = '".$user."' AND pass = '".md5($pass)."'");                
        
        if($login != null){
            $data = array(
                'login' => 'S'
            );
        }else{
            $data = array(
                'login' => 'E',
                'msg' => 'Credenciales incorrectas'
            );
        }
        $this->_helper->json->sendJson($data);
    }


}





